package com.demo.多线程;

/**
 * @Program: java
 * @ClassName DaemonThread
 * @Author: liutao
 * @Description: 用户线程和守护线程
 * @Create: 2023-10-27 16:33
 * @Version 1.0
 **/

public class DaemonThread {
    public static void main(String[] args) {
        Thread a = new Thread(() -> System.out.println(Thread.currentThread().getName() + "：" + (Thread.currentThread().isDaemon() ? "守护线程" : "用户线程")), "a");
        a.setDaemon(true);
        a.start();
        System.out.println(Thread.currentThread().getName() + "：" + (Thread.currentThread().isDaemon() ? "守护线程" : "用户线程"));
    }

}
